//
//  CZComposeMenuButton.swift
//  Blog
//
//  Created by whitcast on 16/7/18.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class CZComposeMenuButton: UIButton {
    // 持有跳转控制器模型
    var composeMenu: CZComposeMenu?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.grayColor(), forState: .Normal)
        titleLabel?.textAlignment = .Center
    }
    // 重写highLighted属性
    override var highlighted: Bool {
        get {
            return false
        }
        set {
            
        }
    }
    // 调整子控件布局
    override func layoutSubviews() {
        super.layoutSubviews()
        // 设置子控件宽高
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = height
        
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
    }
}
